package cn.com.bluemoon.daps.system.controller.api;

import cn.com.bluemoon.daps.common.constant.ServiceNameConstants;
import cn.com.bluemoon.daps.common.datascope.IgnorePermission;
import cn.com.bluemoon.daps.common.domain.ResultBean;
import cn.com.bluemoon.daps.system.entity.DapSystemInfo;
import cn.com.bluemoon.daps.system.entity.DapSystemProperty;
import cn.com.bluemoon.daps.system.service.DapSystemPropertyService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Api(tags = {"FeignClient服务-系统参数api接口"})
@RequestMapping(ServiceNameConstants.DapsApiSystem.API_SYSINFO)
@IgnorePermission(name = "服务注册-系统参数api接口")
@RestController
@Slf4j
public class DapSystemPropertyApi {

    @Autowired
    DapSystemPropertyService dapSystemPropertyService;

    @PostMapping("/property/list")
    public ResultBean<Map<String, List<DapSystemProperty>>> getPropertyInfo(@RequestBody List<String> groupList) {

        Map<String, List<DapSystemProperty>> byPropertyGroups = dapSystemPropertyService.getByPropertyGroups(groupList);
        return ResultBean.ok(byPropertyGroups);
    }

}
